package cc.minos.components.common
{
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	
	/**
	 * ...
	 * @author Minos
	 */
	public class Component extends Sprite
	{
		protected var _type:String = 'component';
		protected var _width:Number = 0;
		protected var _height:Number = 0;
		protected var _enabled:Boolean = true;
		
		public function Component()
		{
			super();
		}
		
		public function move( xpos:Number , ypos:Number ):void
		{
			x = Math.round( xpos );
			y = Math.round( ypos );
		}
		
		public function setSize( w:Number , h:Number ):void
		{
			_width = w;
			_height = h;
			dispatchEvent( new Event( Event.RESIZE ) );
		}
		
		public function get enabled():Boolean
		{
			return _enabled;
		}
		
		public function set enabled( value:Boolean ):void
		{
			_enabled = value;
			tabEnabled = mouseEnabled = mouseChildren = _enabled;
			alpha = _enabled ? 1.0 : 0.5;
		}
		
		public function get type():String
		{
			return _type;
		}
		
		public static function initStage( stage:Stage ):void
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
		}
	
	}

}